package com.ywk.skywalkingApi.business.controller;


import com.ywk.skywalkingApi.business.entity.Student;
import com.ywk.skywalkingApi.business.service.StudentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author zbh
 * @Date 2023/6/28
 */
@RestController
@RequestMapping("/student")
@Slf4j
public class StudentController {

    @Autowired
    StudentService service;

    @GetMapping("/getCount")
    public void getCount(){
        System.out.println(service.getCount());
    }

    @GetMapping("/findAll")
    public List<Student> findAll(){
        log.info("测试接口：student.findAll");
        return service.findAll();
    }

    @GetMapping("/findById/{id}")
    public Student findById(@PathVariable Integer id){
        return service.findById(id);
    }
}
